import java.util.Random;
import java.util.Scanner;

public class SecretNumberGame
{
	public void play()
	{
		Random random = new Random();

		int numberToGuess = 1 + random.nextInt(50);

		Boolean keepLooping = true;

		Scanner userInput = new Scanner(System.in);

		do
		{
			System.out.print("\nGuess a number: ");

			int number = userInput.nextInt();

			if(number == numberToGuess)
			{
				System.out.println("You got it!");
				keepLooping = false;
			}
			else if(number < numberToGuess)
			{
				System.out.println("Your number is too low");
			}
			else if(number > numberToGuess)
			{
				System.out.println("Your number is too hight");
			}
	
		}
		while(keepLooping);
	}
	
}
